<?php

namespace app\api\controller;

use app\common\controller\Api;
use app\api\service\ShoporderService;

class Shoporder extends Api
{
    protected $noNeedLogin = [];
    protected $noNeedRight = '*';

    /**
     * 订单支付
     */
    public function pay()
    {
        $data = $this->request->post();
        $res = ShoporderService::orderPayment($data);
        return json($res);
    }

    /**
     * 订单列表
     */
    public function lists()
    {
        $data = $this->request->post();
        $res = ShoporderService::getOrderLists($data);
        return json($res);
    }

    /**
     * 订单详情
     */
    public function details()
    {
        $data = $this->request->post();
        $res = ShoporderService::getOrderDetails($data);
        return json($res);
    }

    /**
     * 取消订单
     */
    public function cancel()
    {
        $data = $this->request->post();
        $res = ShoporderService::cancelOrder($data);
        return json($res);
    }

    /**
     * 完成订单
     */
    public function finish()
    {
        $data = $this->request->post();
        $res = ShoporderService::finishOrder($data);
        return json($res);
    }

    /**
     * 售后订单
     */
    public function after_sales()
    {
        $data = $this->request->post();
        $res = ShoporderService::afterSalesOrder($data);
        return json($res);
    }

    // 撤销退款
    public function cancel_refund()
    {
        $data = $this->request->post();
        $res = ShoporderService::cancelRefund($data);
        return json($res);
    }

    /**
     * 评价订单
     */
    public function comment()
    {
        $data = $this->request->post();
        $res = ShoporderService::commentOrder($data);
        return json($res);
    }


}